package com.gitee.cui.es;

import java.io.IOException;
import java.util.ArrayList;

import org.apache.http.HttpHost;
import org.elasticsearch.client.Node;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * ES客户端
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-04-05 15:48
 **/
public class ESClient {

	public static void main(String[] args) throws IOException {
		// 创建ES客户端连接
		RestHighLevelClient esClient = new RestHighLevelClient(
				RestClient.builder(new HttpHost("localhost", 9200, "http")));

		// 关闭客户端连接
		esClient.close();
	}
}
